package com.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import com.config.ConfigProperties;

public class JDBCDAOFactory {
	public Connection con = null;

	public JDBCDAOFactory() {
	}

	public Connection conectar(String banco) {
		try {
			Class.forName("org.postgresql.Driver");
			con = DriverManager.getConnection(
					"jdbc:postgresql://localhost:5432/" + banco,
					ConfigProperties.ler().getProperty("user"),
					ConfigProperties.ler().getProperty("senha"));
			System.err.println("conectou");
		} catch (ClassNotFoundException ex) {
			ex.printStackTrace();
		} catch (SQLException ex) {
			ex.printStackTrace();
		}

		return con;
	}

	public void desConnection(Connection con) {

		con = null;
		System.err.println("desconectou");

	}

}
